<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListAnnounceTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <div style=" height: auto; width: 200px; float: left;">
                <h:form>
                    <h:outputLabel value="Address: " for="searchAddress" />
                    <h:inputText id="searchAddress" value="#{propertyController.searchAddress}" title="Address" />
                    <br />
                    <h:outputLabel value="Postcode: " for="searchPostcode" />
                    <h:inputText id="searchPostcode" value="#{propertyController.searchPostcode}" title="Postcode" />
                    <br />
                    <h:outputLabel value="Number Bathroom(min): " for="searchMinNumberBathroom" />
                    <h:inputText id="searchMinNumberBathroom" value="#{propertyController.searchMinNumberBathroom}" title="Number Bathroom(min)" />
                    <br />
                    <h:outputLabel value="Number Bathroom(max): " for="searchMaxNumberBathroom" />
                    <h:inputText id="searchMaxNumberBathroom" value="#{propertyController.searchMaxNumberBathroom}" title="Number Bathroom(max)" />
                    <br />
                    <h:outputLabel value="Number Bedroom(min): " for="searchMinNumberBedroom" />
                    <h:inputText id="searchMinNumberBedroom" value="#{propertyController.searchMinNumberBedroom}" title="Number Bedroom(min)" />
                    <br />
                    <h:outputLabel value="Number Bedroom(max): " for="searchMaxNumberBedroom" />
                    <h:inputText id="searchMaxNumberBedroom" value="#{propertyController.searchMaxNumberBedroom}" title="Number Bedroom(max)" />

                    <br />

                    <h:outputLabel value="Furnished: " for="searchFurnished" />
                    <h:selectOneMenu id="searchFurnished" value="#{propertyController.searchFurnished}" title="Furnished">
                        <f:selectItem itemValue="" itemLabel=""/>
                        <f:selectItem itemValue="True" itemLabel="Yes"/>
                        <f:selectItem itemValue="False" itemLabel="No"/>
                    </h:selectOneMenu>
                    <br />
                    <h:outputLabel value="Type: " for="searchType" />
                    <h:inputText id="searchType" value="#{propertyController.searchType}" title="Type" />
                    <br />
                    <h:outputLabel value="Garden: " for="searchGarden" />
                    <h:selectOneMenu id="searchGarden" value="#{propertyController.searchGarden}" title="Garden">
                        <f:selectItem itemValue="" itemLabel=""/>
                        <f:selectItem itemValue="True" itemLabel="Yes"/>
                        <f:selectItem itemValue="False" itemLabel="No"/>
                    </h:selectOneMenu>
                    <br />
                    <h:outputLabel value="Price: " for="searchPrice" />
                    <h:inputText id="searchPrice" value="#{propertyController.searchPrice}" title="Price" />
                    <br />

                    <h:commandButton action="#{propertyController.prepareList}" value="Search"/>
                    <br />
                </h:form>
            </div>
            <div style=" height: auto; width: 824px; float: left; border-left: 10px">
                <h:form styleClass="jsfcrud_list_form">
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListAnnounceEmpty}" rendered="#{announceController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{announceController.items.rowCount > 0}">
                        <h:outputText value="#{announceController.pagination.pageFirstItem + 1}..#{announceController.pagination.pageLastItem + 1}/#{announceController.pagination.itemsCount}"/>&nbsp;
                        <h:commandLink action="#{announceController.previous}" value="#{bundle.Previous} #{announceController.pagination.pageSize}" rendered="#{announceController.pagination.hasPreviousPage}"/>&nbsp;
                        <h:commandLink action="#{announceController.next}" value="#{bundle.Next} #{announceController.pagination.pageSize}" rendered="#{announceController.pagination.hasNextPage}"/>&nbsp;






                        <h:dataTable value="#{announceController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="address"/>
                                </f:facet>
                                <h:outputText value="#{item.idProperty.address}"/><br></br>
                                <h:outputText value="#{item.idProperty.address2}"/><br></br>
                                <h:outputText value="#{item.idProperty.postcode}"/><br></br>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_startDate}"/>
                                </f:facet>
                                <h:outputText value="#{item.startDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_finishDate}"/>
                                </f:facet>
                                <h:outputText value="#{item.finishDate}">
                                    <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_type}"/>
                                </f:facet>
                                <h:outputText value="#{item.type}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_status}"/>
                                </f:facet>
                                <h:outputText value="#{item.status}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_description}"/>
                                </f:facet>
                                <h:outputText value="#{item.description}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_price}"/>
                                </f:facet>
                                <h:outputText value="#{item.price}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_idProperty}"/>
                                </f:facet>
                                <h:outputText value="#{item.idProperty}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListAnnounceTitle_winningIdOffer}"/>
                                </f:facet>
                                <h:outputText value="#{item.winningIdOffer}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <h:commandLink action="#{announceController.prepareView}" value="#{bundle.ListAnnounceViewLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{announceController.prepareEdit}" value="#{bundle.ListAnnounceEditLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{announceController.destroy}" value="#{bundle.ListAnnounceDestroyLink}"/>
                            </h:column>
                        </h:dataTable>
                    </h:panelGroup>
                    <br />
                    <h:commandLink action="#{announceController.prepareCreate}" value="#{bundle.ListAnnounceCreateLink}"/>
                    <br />
                    <br />
                    <h:commandLink value="#{bundle.ListAnnounceIndexLink}" action="/index" immediate="true" />
                </h:form>
            </div>
        </ui:define>
    </ui:composition>

</html>
